package com.example.lists;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author hej
 * @date 2023/2/10 14:54
 */
public class ListToList {
    public static void main(String[] args) {
        test();
    }

    public static void test(){
        List<User> users = new ArrayList<>();
        users.add(new User(1,1,"1"));
        users.add(new User(2,2,"2"));
        users.add(new User(3,3,"3"));
        List<Classes> classes = users.stream().map(m -> {
            Classes cls = new Classes();
            cls.setId(m.getId());
            cls.setName(m.getLable());
            cls.setParentId(m.getParentId());
            return cls;
        }).collect(Collectors.toList());
        System.out.println(classes);
    }
}
